﻿<%@ Page Theme="Default" Language="C#" MasterPageFile="~/MasterPage/MasterPage.master" AutoEventWireup="true" CodeFile="ShoppingCart.aspx.cs" Inherits="webapp4U.UI._Default" %>
<%@ Import Namespace="webapp4U" %>
<%@ Register TagPrefix="webapp4U" Namespace="webapp4U.UI" %>
<%@ Register Src="~/Controls/Title.ascx" TagName="Title" TagPrefix="uc" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PageContent" Runat="Server">

<uc:Title runat="server" ID="Title" />

  <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
 
    <table border="0" width="100px" cellpadding="0"  cellspacing="0" align="center">
    <tr>
        <td style="padding-top:5pt;" align="center">
            <asp:GridView runat="server" Width="500px" HorizontalAlign="Center" 
                ID="GridViewItem" 
                DataSourceID="ItemDataSource" 
                AutoGenerateColumns="false" 
                AllowPaging="True" 
                AllowSorting="True" 
                PagerSettings-Mode="NumericFirstLast"
                GridLines="none">
                <Columns>
                    <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20px" HeaderStyle-Width="20px"
                        HeaderText="Delete">
                        <HeaderTemplate>
                            <input id="chkAll" onclick="javascript:SelectAllCheckboxes(this);" runat="server" type="checkbox" />
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:CheckBox runat="server" ID="chkSelect" ToolTip='<%# Eval("ProductID") %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                                                        
                    <asp:TemplateField HeaderText="Image" 
                        HeaderStyle-Width="60" ItemStyle-Width="60"
                        HeaderStyle-HorizontalAlign="Center"
                        ItemStyle-HorizontalAlign="Center">
                        <HeaderTemplate><%=ResourceManager.GetString("Image") %></HeaderTemplate>
                        <ItemTemplate>
                            <table>
                                <tr>
                                    <td align="center" width="41px" height="41px" style="border:solid 1px #cccccc; cursor:pointer">
                                         <img border="0" src='<%=Globals.ApplicationPath %>Products/Image.ashx?Size=S&ImageUrl=<%# webapp4U.BOL.Products.GetImageUrlByID((int)Eval("ProductID"))%>' />   
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Sản phẩm" 
                        HeaderStyle-Width="200" ItemStyle-Width="200" ItemStyle-Height="40"
                        HeaderStyle-HorizontalAlign="Left"
                        ItemStyle-HorizontalAlign ="left">
                        <HeaderTemplate><%=ResourceManager.GetString("Product_TenSanPham")%></HeaderTemplate>
                        <ItemTemplate>
                            <%# Eval("Title") %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Giá bán(VND)" 
                        HeaderStyle-Width="100" ItemStyle-Width="100"
                        HeaderStyle-HorizontalAlign="Left"
                        ItemStyle-HorizontalAlign ="left">
                        <HeaderTemplate><%=ResourceManager.GetString("Product_Price")%></HeaderTemplate>
                        <ItemTemplate>
                              <span style="font-weight:normal"><%# Formatter.FormatMoney((Decimal)Eval("UnitPrice"))%> VND</span>
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px" HeaderStyle-Width="100px"
                        HeaderText="Delete">
                        <HeaderTemplate><%=ResourceManager.GetString("Product_Quantity")%></HeaderTemplate>
                        <ItemTemplate>
                            <asp:TextBox runat="server" ID="txtQuantity" Text='<%# Eval("Quantity") %>' Width="40"></asp:TextBox>
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                </Columns>
                <EmptyDataTemplate>
                    <table align="center" width="100%" border="0" bgcolor="#ffffcc" bordercolorlight="#0099cc"  bordercolor="#0099cc">
                        <tr>
                            <td height="50" align="center">
                                <div align="center" id="EmptyData"><%=ResourceManager.GetString("Product_ShoppingCartEmpty")%></div>
                            </td>   
                        </tr>
                    </table>
                </EmptyDataTemplate>
            </asp:GridView>            
        </td>
    </tr>
    <tr>
        <td align="right"> 
            <asp:Panel runat="server" ID="PanelUpdate">
                <table cellpadding="0" cellspacing="0">
                    <tr>
                        <td align="right" class="ProductPrice" style="padding-top:8px;">
                            <%=ResourceManager.GetString("Product_Subtotal")%>: <%=Formatter.FormatMoney(webapp4U.BOL.ShoppingCart.GetSubTotalShoppingCart())%> VNĐ
                        </td>
                    </tr>
                    <tr>
                        <td align="right" style="padding-top:8px;">
                        <br />
                        <webapp4U:Button runat="server" ID="btDelete" Text=" Delete " ResourceName="Product_Delete" OnClick="btDelete_Click" />
                        &nbsp;&nbsp;
                        <webapp4U:Button runat="server" ID="btUpdate" Text=" Cập nhật " ResourceName="Product_Update" OnClick="btUpdate_Click"  /></td>
                    </tr>
                    
                    <tr>
                        <td align="right" style="padding-top:25px;">
                            <asp:HyperLink CssClass="ProceedOrder" runat="server" ID="linkProceedOrder" NavigateUrl="~/Products/ProceedOrder.aspx"><%=ResourceManager.GetString("Product_ProceedOrder")%></asp:HyperLink>
                            &nbsp;&nbsp;
                            <a class="ProceedOrder" href="<%=Globals.ApplicationPath %>Products/Product.aspx?CateID=<%=CateID%>"><%=ResourceManager.GetString("Product_ContinueShopping")%></a>
                        </td>
                    </tr>
                </table>
            </asp:Panel>
        </td>
    </tr>
    </table>

   </ContentTemplate>
</asp:UpdatePanel>

 <asp:ObjectDataSource
    ID="ItemDataSource"
    runat="server"
    SelectMethod="GetShoppingCartByUserID"
    TypeName="webapp4U.BOL.ShoppingCart">
</asp:ObjectDataSource>

                                  
</asp:Content>

